import java.util.Arrays;
import java.util.Comparator;
import java.util.Random;

public class Main {
    public static void main(String[] args) {
        Integer[] array = Integers.random(100, 1000, 9999);
        assert array != null;
        Arrays.sort(array);

        BinarySearch<Integer> binarySearch = new BinarySearch<>(new Comparator<>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o1 - o2;
            }
        });

        Random random = new Random();
        int randomIndex = random.nextInt(array.length);
        Integer targetElement = array[randomIndex];

        int index_iter = binarySearch.search_iter(array, targetElement);
        Asserts.test(index_iter == randomIndex);

        int index_recu = binarySearch.search_recu(array, targetElement);
        Asserts.test(index_recu == randomIndex);
    }
}
